﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows.Forms;
using ebcmassendaten.fileadapter;
using ebcmassendaten.pagebuilder;
using ebcmassendaten.recordbuilder;
using ebcmassendaten.specifications;
using Microsoft.Practices.Unity;

namespace ebcmassendaten.host
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Trace.TraceInformation("ebc.massendaten start");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            IUnityContainer uc = new UnityContainer();
            uc.RegisterType<IPortal, Portal>(new ContainerControlledLifetimeManager());
            uc.RegisterType<IFileAdapter, FileAdapter>();
            uc.RegisterType<IRecordBuilder, RecordBuilder>();
            uc.RegisterType<IPageBuilder, PageBuilder>();

            new myapp.wiring.MainBoard(uc.Resolve<IPortal>(),
                                       uc.Resolve<IFileAdapter>(),
                                       uc.Resolve<IRecordBuilder>(),
                                       uc.Resolve<IPageBuilder>());

            Application.Run((Form)uc.Resolve<IPortal>());

            Trace.TraceInformation("ebc.massendaten ende");
            Trace.Close();
        }
    }
}
